﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ooganizer.Server
{    
    [Serializable]
    public class ILogProxy : log4net.ILog
    {
        #region Constructor
        public ILogProxy(Type type)
        {
            _type = type;
        }
        #endregion

        #region ILogProxy Members

        public void Debug(object message, Exception exception)
        {
            LoggerInstance.Debug(message, exception);
        }

        public void Debug(object message)
        {
            LoggerInstance.Debug(message);
        }

        public void DebugFormat(IFormatProvider provider, string format, params object[] args)
        {
            LoggerInstance.DebugFormat(provider, format, args);
        }

        public void DebugFormat(string format, object arg0, object arg1, object arg2)
        {
            LoggerInstance.DebugFormat(format, arg0, arg1, arg2);
        }

        public void DebugFormat(string format, object arg0, object arg1)
        {
            LoggerInstance.DebugFormat(format, arg0, arg1);
        }

        public void DebugFormat(string format, object arg0)
        {
            LoggerInstance.DebugFormat(format, arg0);
        }

        public void DebugFormat(string format, params object[] args)
        {
            LoggerInstance.DebugFormat(format, args);
        }

        public void Error(object message, Exception exception)
        {
            LoggerInstance.Error(message, exception);
        }

        public void Error(object message)
        {
            LoggerInstance.Error(message);
        }

        public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
        {
            LoggerInstance.ErrorFormat(provider, format, args);
        }

        public void ErrorFormat(string format, object arg0, object arg1, object arg2)
        {
            LoggerInstance.ErrorFormat(format, arg0, arg1, arg2);
        }

        public void ErrorFormat(string format, object arg0, object arg1)
        {
            LoggerInstance.ErrorFormat(format, arg0, arg1);
        }

        public void ErrorFormat(string format, object arg0)
        {
            LoggerInstance.ErrorFormat(format, arg0);
        }

        public void ErrorFormat(string format, params object[] args)
        {
            LoggerInstance.ErrorFormat(format, args);
        }

        public void Fatal(object message, Exception exception)
        {
            LoggerInstance.Fatal(message, exception);
        }

        public void Fatal(object message)
        {
            LoggerInstance.Fatal(message);
        }

        public void FatalFormat(IFormatProvider provider, string format, params object[] args)
        {
            LoggerInstance.FatalFormat(provider, format, args);
        }

        public void FatalFormat(string format, object arg0, object arg1, object arg2)
        {
            LoggerInstance.FatalFormat(format, arg0, arg1, arg2);
        }

        public void FatalFormat(string format, object arg0, object arg1)
        {
            LoggerInstance.FatalFormat(format, arg0, arg1);
        }

        public void FatalFormat(string format, object arg0)
        {
            LoggerInstance.FatalFormat(format, arg0);
        }

        public void FatalFormat(string format, params object[] args)
        {
            LoggerInstance.FatalFormat(format, args);
        }

        public void Info(object message, Exception exception)
        {
            LoggerInstance.Info(message, exception);
        }

        public void Info(object message)
        {
            LoggerInstance.Info(message);
        }

        public void InfoFormat(IFormatProvider provider, string format, params object[] args)
        {
            LoggerInstance.InfoFormat(provider, format, args);
        }

        public void InfoFormat(string format, object arg0, object arg1, object arg2)
        {
            LoggerInstance.InfoFormat(format, arg0, arg1, arg2);
        }

        public void InfoFormat(string format, object arg0, object arg1)
        {
            LoggerInstance.InfoFormat(format, arg0, arg1);
        }

        public void InfoFormat(string format, object arg0)
        {
            LoggerInstance.InfoFormat(format, arg0);
        }

        public void InfoFormat(string format, params object[] args)
        {
            LoggerInstance.InfoFormat(format, args);
        }

        public bool IsDebugEnabled
        {
            get { return LoggerInstance.IsDebugEnabled; }
        }

        public bool IsErrorEnabled
        {
            get { return LoggerInstance.IsErrorEnabled; }
        }

        public bool IsFatalEnabled
        {
            get { return LoggerInstance.IsFatalEnabled; }
        }

        public bool IsInfoEnabled
        {
            get { return LoggerInstance.IsInfoEnabled; }
        }

        public bool IsWarnEnabled
        {
            get { return LoggerInstance.IsWarnEnabled; }
        }

        public void Warn(object message, Exception exception)
        {
            LoggerInstance.Warn(message, exception);
        }

        public void Warn(object message)
        {
            LoggerInstance.Warn(message);
        }

        public void WarnFormat(IFormatProvider provider, string format, params object[] args)
        {
            LoggerInstance.WarnFormat(provider, format, args);
        }

        public void WarnFormat(string format, object arg0, object arg1, object arg2)
        {
            LoggerInstance.WarnFormat(format, arg0, arg1, arg2);
        }

        public void WarnFormat(string format, object arg0, object arg1)
        {
            LoggerInstance.WarnFormat(format, arg0, arg1);
        }

        public void WarnFormat(string format, object arg0)
        {
            LoggerInstance.WarnFormat(format, arg0);
        }

        public void WarnFormat(string format, params object[] args)
        {
            LoggerInstance.WarnFormat(format, args);
        }

        #endregion

        #region ILoggerWrapper Members
        public log4net.Core.ILogger Logger
        {
            get { return logger.Logger; }
        }
        #endregion

        #region Private Properties
        private log4net.ILog LoggerInstance
        {
            get
            {
                if (logger == null)
                {
                    logger = log4net.LogManager.GetLogger(_type);
                }

                return logger;
            }
        }
        #endregion

        #region Private Fields
        [NonSerialized]
        private log4net.ILog logger;

        private Type _type;

        #endregion
    }
}
